<!--
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-08-29 10:18:38
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-08-29 10:53:48
 * @FilePath: \cxl-admin\src\pages\newEnergyReportScore\Index.vue
-->
<template>
    <section class="score">
        数据格式： {}
        <section class="score-box">
            <section class="report-data">
                <el-input
                    v-model="textarea"
                    :autosize="{ minRows: 20, maxRows: 20 }"
                    type="textarea"
                    placeholder="请粘贴新能源报告数据"
                />
                <el-button @click="onConfirm">确定</el-button>
            </section>
            <section class="report-score">
                <section>最后得分：{{ totalScore }}分</section>
                <!-- <p v-for="item in rules" :key="item">{{ item }}</p> -->
            </section>
        </section>
    </section>
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { NewEnergyScore } from './newEnergyScore'

const textarea = ref('')
const score = new NewEnergyScore()
const totalScore = ref(0)
const rules: any[] = reactive([])

const onConfirm = () => {
    console.log('textarea', textarea.value)
    totalScore.value = score.init(JSON.parse(textarea.value))
    rules.length = 0
    rules.push(...score.rule)
}
</script>

<style scoped lang="scss">
.score {
    box-sizing: border-box;
    padding: 16px;
    .score-box {
        display: flex;
        > section {
            width: 50%;
        }
    }
}
</style>
